package com.bit.inmap;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListAdapter extends BaseAdapter {
	private Context mContext;
	private int mLayout;
	private LayoutInflater mInflater;
	private ArrayList<item_list> mItems = new ArrayList<item_list>();
	
	public ListAdapter(Context mContext, int mLayout, ArrayList<item_list> arrData) {
		super();
		this.mContext = mContext;
		this.mLayout = mLayout;
		this.mItems = arrData;
		mInflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mItems.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mItems.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView==null) {
			convertView = mInflater.inflate(mLayout, parent, false);
		}				
		
		TextView textview = (TextView)convertView.findViewById(R.id.item);
		textview.setText(mItems.get(position).content);	
		
		return convertView;
	}
}

